package com.example.demo.controller;


import com.example.demo.bean.Reason;
import com.example.demo.sevice.ReasonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
/*@RequestMapping("/reason")*/
public class ReasonController {
    @Autowired
    private ReasonService reasonService;

    /*查询*/
    @RequestMapping("/ras")
    public List<Reason> reasons() {
        return reasonService.reason();
    }

    //*新增*//
    @RequestMapping("/addr")
    public void addReason(@RequestParam("type") String type) {
        System.out.println(type);
        reasonService.addReason(type);
    }

    /*删除*/
    @DeleteMapping("/dele")
    public void deleteReason(@RequestParam("numberID") String numberID) {
        reasonService.deleteReason(numberID);
        System.out.println(numberID);
    }

    /*修改*/
    @PostMapping("/up")
    public void updateReason(Reason reason) {
        reasonService.updateReason(reason);
        System.out.println(reason);
    }
}
